package com.example.java_chatroom_redis_rabbitmq.mapper;

import com.example.java_chatroom_redis_rabbitmq.model.Message;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageMapper {
    @Select("select * from message where sessionId=#{sessionId}")
    List<Message> getMessageBySessionId(Integer sessionId);

    @Insert("insert into message values(null,#{sessionId},#{fromId},#{fromName},#{fromImage},#{content},#{postTime})")
    Integer addMessage(Message message);
}
